$c-mselect: $c-primary;

.mselect {
  position: relative;
  white-space: nowrap;

  &__toggle {
    @include hide;
  }

  &__label {
    @extend %box-neat, %metal, %flex-between;

    flex-flow: row nowrap;
    padding: 0.3rem 0.3rem 0.3rem 1rem;
    cursor: pointer;

    &:hover {
      @extend %metal-hover;
    }

    &::after {
      @extend %data-icon;

      content: '';
      font-size: 70%;
      color: $c-mselect;
    }
  }

  &__toggle:checked ~ .mselect__label {
    @include transition(opacity);

    opacity: 0;
  }

  &__list {
    @extend %base-font, %box-radius, %popup-shadow, %flex-column;

    position: absolute;
    top: 0;
    left: 0;
    min-width: 100%;
    max-height: 60vh;
    overflow-y: auto;
    z-index: z('mselect');
    background: $c-bg-popup;
    transform: scale(1, 0);
    transform-origin: top;

    @include transition(transform);

    .current {
      background: $c-bg-zebra;

      @extend %flex-between-nowrap;

      &::after {
        @extend %data-icon;

        content: '';
        flex: 1 1 100%;
        text-align: right;
      }
    }

    > * {
      white-space: nowrap;
      display: block;
      padding: 0.3em 1em;

      @include transition;

      color: $c-mselect;

      &:hover {
        background: $c-mselect;
        color: #fff;
      }

      &::before {
        margin-right: 0.4em;
      }

      opacity: 0;
    }

    .mselect__toggle:checked ~ & {
      transform: scale(1, 1);

      @include breakpoint($mq-not-small) {
        position: fixed;
        top: 50%;
        transform: translateY(-50%) scale(1, 1);
      }

      > * {
        opacity: 1;
        transition: opacity 125ms ease-in-out 125ms;
      }
    }
  }
}
